package com.tencent.txcc.feign;

import com.tencent.txcc.domain.Login;
import com.tencent.txcc.enums.GlobleExceptionCode;
import com.tencent.txcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class LoginServiceFallbackFactory implements FallbackFactory<LoginService> {
    @Override
    public LoginService create(Throwable e) {
        e.printStackTrace();
        log.error("uaa发生异常，错误信息为：{}", e.getMessage());
        return new LoginService(){

            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error(GlobleExceptionCode.ERROR);
            }
        };
    }
}
